home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / Hot Demos! / DroidWorks demo / dwCD.gob / mission_cog_b0_env_gear.cog < prev    next >
Text File  |  1998-09-17  |  2KB  |  119 lines

  1. # DroidWorks
  2. #     b0_env_battery.cog
  3. #     
  4. #    Randomizer cog for the Gear level.  
  5. #
  6. #
  7. #
  8. # Script handles random enviroment object for the maze. 
  9. # taken from env_pulley
  10. #
  11. #  
  12. # [01/16/98] DGS    Created 
  13. # [01/26/98] DGS    Added code to make it random
  14. # [01/30/98] DGS    Took from env_gear.cog and added extra things
  15. # [02/04/98] DGS    Took from b0_enf_pulley.
  16. # [03/30/98] DGS     Took from Maze_rand and converted it to Gears. 
  17.  
  18.  
  19. symbols
  20.  
  21. sector         Shuffle_s
  22. thing        thing1
  23. thing        thing2
  24. thing        thing3
  25.     
  26. message        startup
  27. message     pulse
  28. message     entered
  29. message     taken
  30.  
  31.  
  32. int            amount=3        
  33. int            inv_number=0
  34. int            act_thing=0        local
  35. flex        set=0.0            local
  36. int            enter=0            local
  37.  
  38. end
  39.  
  40. # ========================================================================================
  41.  
  42. code
  43. startup:
  44.     setpulse(0.2);
  45.     return;
  46.  
  47. pulse:
  48.         set = (rand()*amount);
  49.        // print("luke");
  50.        // printflex(set);
  51.         return;
  52.  
  53. entered:
  54.         if (enter == 0)
  55.             {
  56.             print("b0_env_Ger.cog: Entered");
  57.             enter = 1;
  58.             setpulse(0);
  59.             call destroy;
  60.             }
  61.         return;
  62.     
  63. destroy:
  64.     if (set < 1)
  65.         {
  66.         if (thing2 != -1) destroything(thing2);
  67.         if (thing3 != -1) destroything(thing3);
  68.         act_thing = thing1;
  69.         }
  70.     else if ( set < 2)
  71.         {
  72.         if (thing1 != -1) destroything(thing1);
  73.         if (thing3 != -1) destroything(thing3);
  74.         act_thing = thing2;
  75.         
  76.         }
  77.     else if ( set < 3)
  78.         {
  79.         if (thing1 != -1) destroything(thing1);
  80.         if (thing2 != -1) destroything(thing2);
  81.         act_thing = thing3;
  82.         
  83.         }
  84.     
  85.     return;
  86. taken:
  87.      print("taken");
  88.     arm_str = dwGetArmStrength();
  89.     print("arm strength is");
  90.     printint(arm_str);
  91.     if (arm_str > 8)
  92.         {
  93.         print("you are strong");
  94.           SetInvAvailable(getlocalplayerthing(), inv_number, 1);
  95.         ChangeInv(getlocalplayerthing(), inv_number, 1);
  96.         destroything(act_thing);
  97.         dwflashinventory();
  98.         if (inv_number == 25)
  99.             {
  100.             // 17307 You picked up a small gear.
  101.             dwPlayCammySpeech(17307, "t9ca008.wav", 10, 0);
  102.             }
  103.         else if (inv_number == 26)
  104.             {
  105.             dwPlayCammySpeech(17308, "t9ca009.wav", 10, 0);
  106.             }
  107.         }
  108.     else
  109.         {
  110.           print("you are weak");
  111.         dwplaycammyspeech(0, "m2ca022.wav", 20, 2); 
  112.         }
  113.  
  114. return;
  115.         
  116.  
  117. end
  118.  
  119.